package com.example.zkWebClient.domain;

import java.util.List;

/**
 * 对应zTree的树节点
 * 
 * @author: jie.deng
 * @time: 2017年12月26日 上午10:23:24
 */
public class TreeNode {

	private Integer id;
	private Integer pId;
	private String name; // zTree节点名称
	private String isParent; // zTree节点是否父节点，"true"或者"false"
	private List<TreeNode> children;

	private String isEphemeral; // zTree节点是否可以新增节点，"true"或者"false"
	private String path; // zTree节点对应的znode path
	private String data; // zTree节点对应的znode data

	public TreeNode() {

	}

	public TreeNode(ZNode node) {
		String path = node.getPath();
		this.setPath(path);
		this.setName(path.equals("/") ? "/" : path.substring(path.lastIndexOf("/") + 1));
		this.setIsParent(node.getStat().getNumChildren() > 0 ? "true":"false");
		this.setIsEphemeral(node.getStat().getEphemeralOwner() == 0 ? "false":"true");
		this.setData(node.getData());
	}

	public Integer getId() {
		return id;
	}

	public void setId(Integer id) {
		this.id = id;
	}

	public Integer getpId() {
		return pId;
	}

	public void setpId(Integer pId) {
		this.pId = pId;
	}

	public String getName() {
		return name;
	}

	public void setName(String name) {
		this.name = name;
	}

	public String getIsParent() {
		return isParent;
	}

	public void setIsParent(String isParent) {
		this.isParent = isParent;
	}

	public List<TreeNode> getChildren() {
		return children;
	}

	public void setChildren(List<TreeNode> children) {
		this.children = children;
	}

	public String getPath() {
		return path;
	}

	public void setPath(String path) {
		this.path = path;
	}

	public String getData() {
		return data;
	}

	public void setData(String data) {
		this.data = data;
	}

	public String getIsEphemeral() {
		return isEphemeral;
	}

	public void setIsEphemeral(String isEphemeral) {
		this.isEphemeral = isEphemeral;
	}

}
